import userApi from "/api/user.js";

export default {
  namespaced: true,
  state: {
    userInfo: {}
  },
  actions: {
    async getUserInfo({ commit }) {
      const userRes = await userApi.gteUserByOpenid()
      const userInfo = userRes.data
      console.log('userInfo', userInfo)
      commit('SET_USER_INFO', userInfo)
      return userInfo
    }
  },
  mutations: {
    SET_USER_INFO(state, data = {}) {
      state.userInfo = data || {}
    }
  }
}